package com.app.controller.backstage;

import com.app.common.Result;
import com.app.service.BrowseNumberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("/jtwq")
public class BrowseNumberController {


    @Autowired
    BrowseNumberService browseNumberService;

    /**
     * 新增访问
     */
    @GetMapping("/addBrowse")
    @ResponseBody
    public Result<Object> addBrowse(HttpServletRequest request) {
        String token = request.getHeader("authori-zation");
        int code = browseNumberService.addBrowse(token);
        if (code == 200) {
            return Result.success("新增访问成功");
        } else {
            return Result.error(code, "操作失败");
        }
    }
}
